﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
using System.Text;
using EnvDTE;

namespace PowerGuiVsx.Module
{
    [Cmdlet(VerbsCommon.Get, "Project")]
    public class GetProjectCommand : PowerGuiVsxCommand
    {
        [Parameter()]
        public string Name { get; set; }

        protected override void BeginProcessing()
        {
            var dte = (DTE)Package.GetService(typeof(DTE));

            foreach (EnvDTE.Project project in dte.ActiveSolutionProjects)
            {
                if (String.IsNullOrEmpty(Name) || project.FullName.Contains(Name))
                {
                    WriteObject(new PowerGuiVsx.Module.Objects.Project(project));
                }
            }
        }

    }
}
